home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / t2win-32 / _dastr.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-08-24  |  10.2 KB  |  261 lines

  1. VERSION 4.00
  2. Begin VB.Form frmDAString 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Disk array : string"
  5.    ClientHeight    =   4065
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3255
  8.    ClientWidth     =   8130
  9.    Height          =   4470
  10.    Left            =   1830
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4065
  14.    ScaleWidth      =   8130
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   2910
  17.    Width           =   8250
  18.    Begin Threed.SSPanel SSPanel1 
  19.       Align           =   1  'Align Top
  20.       Height          =   480
  21.       Left            =   0
  22.       TabIndex        =   2
  23.       Top             =   0
  24.       Width           =   8130
  25.       _Version        =   65536
  26.       _ExtentX        =   14340
  27.       _ExtentY        =   847
  28.       _StockProps     =   15
  29.       ForeColor       =   -2147483640
  30.       BackColor       =   12632256
  31.       Begin VB.ComboBox cmb_Function 
  32.          Height          =   315
  33.          Left            =   1365
  34.          TabIndex        =   3
  35.          Top             =   90
  36.          Width           =   5415
  37.       End
  38.       Begin Threed.SSCommand cmdNP 
  39.          Height          =   300
  40.          Index           =   1
  41.          Left            =   7770
  42.          TabIndex        =   7
  43.          Top             =   90
  44.          Width           =   255
  45.          _Version        =   65536
  46.          _ExtentX        =   450
  47.          _ExtentY        =   529
  48.          _StockProps     =   78
  49.          Caption         =   ">"
  50.          BevelWidth      =   1
  51.          Font3D          =   3
  52.          RoundedCorners  =   0   'False
  53.          Outline         =   0   'False
  54.       End
  55.       Begin Threed.SSCommand cmdNP 
  56.          Height          =   300
  57.          Index           =   0
  58.          Left            =   6930
  59.          TabIndex        =   6
  60.          Top             =   90
  61.          Width           =   255
  62.          _Version        =   65536
  63.          _ExtentX        =   450
  64.          _ExtentY        =   529
  65.          _StockProps     =   78
  66.          Caption         =   "<"
  67.          BevelWidth      =   1
  68.          Font3D          =   3
  69.          RoundedCorners  =   0   'False
  70.          Outline         =   0   'False
  71.       End
  72.       Begin VB.Label Label2 
  73.          Caption         =   "&Select a function"
  74.          Height          =   255
  75.          Left            =   90
  76.          TabIndex        =   5
  77.          Top             =   120
  78.          Width           =   1275
  79.       End
  80.       Begin Threed.SSCommand SSCommand1 
  81.          Default         =   -1  'True
  82.          Height          =   300
  83.          Left            =   7245
  84.          TabIndex        =   4
  85.          Top             =   90
  86.          Width           =   465
  87.          _Version        =   65536
  88.          _ExtentX        =   820
  89.          _ExtentY        =   529
  90.          _StockProps     =   78
  91.          Caption         =   "&Go"
  92.          BevelWidth      =   1
  93.          RoundedCorners  =   0   'False
  94.          Outline         =   0   'False
  95.       End
  96.    End
  97.    Begin VB.Label lbl_Result 
  98.       Appearance      =   0  'Flat
  99.       BackColor       =   &H80000005&
  100.       BackStyle       =   0  'Transparent
  101.       ForeColor       =   &H80000008&
  102.       Height          =   3345
  103.       Left            =   2970
  104.       TabIndex        =   1
  105.       Top             =   630
  106.       Width           =   5055
  107.    End
  108.    Begin VB.Label lbl_Open 
  109.       Appearance      =   0  'Flat
  110.       BackColor       =   &H80000005&
  111.       BackStyle       =   0  'Transparent
  112.       BeginProperty Font 
  113.          name            =   "Courier New"
  114.          charset         =   0
  115.          weight          =   400
  116.          size            =   8.25
  117.          underline       =   0   'False
  118.          italic          =   0   'False
  119.          strikethrough   =   0   'False
  120.       EndProperty
  121.       ForeColor       =   &H80000008&
  122.       Height          =   3345
  123.       Left            =   90
  124.       TabIndex        =   0
  125.       Top             =   630
  126.       Width           =   2715
  127.    End
  128. Attribute VB_Name = "frmDAString"
  129. Attribute VB_Creatable = False
  130. Attribute VB_Exposed = False
  131. Option Explicit
  132. Option Base 1
  133. Private Const Iteration = 50
  134. Dim IsLoaded         As Integer
  135. Dim TimerStartOk     As Integer
  136. Dim TimerCloseOk     As Integer
  137. Dim TimerHandle      As Integer
  138. Dim TimerValue       As Long
  139.       
  140. Private Sub cmdNP_Click(Index As Integer)
  141.    Call sub_NextPrev(cmb_Function, Index)
  142. End Sub
  143. Private Sub cmb_Function_Click()
  144.    If (IsLoaded = False) Then Exit Sub
  145.    Call cDisableFI(mdiT2W.Picture1)
  146.    lbl_Result = ""
  147.    DoEvents
  148.    Call TestDAString(cmb_Function.ListIndex - 1)
  149.    DoEvents
  150.    Call cEnableFI(mdiT2W.Picture1)
  151. End Sub
  152. Private Sub Form_Activate()
  153.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  154. End Sub
  155. Private Sub Form_Load()
  156.    IsLoaded = False
  157.    Show
  158.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_dastr.t2w")
  159.    IsLoaded = True
  160. End Sub
  161. Private Sub Form_Unload(Cancel As Integer)
  162.    Dim intResult        As Integer
  163.    intResult = cKillFileAll("c:\t2w_tmp\dastr.tmp")
  164. End Sub
  165. Private Sub SSCommand1_Click()
  166.    Call cmb_Function_Click
  167. End Sub
  168. Private Sub TestDAString(intManagement As Integer)
  169.    Dim intResult        As Integer
  170.    Dim strResult        As String
  171.    Dim strOpen          As String
  172.    Dim strDisplay       As String
  173.    Dim i                As Integer
  174.    Dim DA               As tagDISKARRAY
  175.    intResult = 0
  176.    strResult = ""
  177.    strOpen = ""
  178.    strDisplay = ""
  179.       
  180.    DA.nFilename = T2WDirTest + "\dastr.tmp"
  181.    DA.nType = 50
  182.    DA.nIsTyped = False
  183.    DA.nRows = 100
  184.    DA.nCols = 100
  185.    DA.nSheets = 2
  186.    Select Case intManagement
  187.       Case True      'create
  188.          intResult = cDACreate(DA, True)
  189.       Case False     'use
  190.          intResult = cDACreate(DA, False)
  191.       Case 1         'clear all
  192.          intResult = cDACreate(DA, False)
  193.          If (intResult = -1) Then intResult = cDAClear(DA)
  194.       Case 2         'clear sheet 2
  195.          intResult = cDACreate(DA, False)
  196.          If (intResult = -1) Then intResult = cDAClearSheet(DA, 2)
  197.       Case 3         'clear last row
  198.          intResult = cDACreate(DA, False)
  199.          If (intResult = -1) Then intResult = cDAClearRow(DA, DA.nRows, 1)
  200.       Case 4         'clear last col
  201.          intResult = cDACreate(DA, False)
  202.          If (intResult = -1) Then intResult = cDAClearCol(DA, DA.nCols, 1)
  203.       Case 5         'clear last row in all sheets
  204.          intResult = cDACreate(DA, False)
  205.          If (intResult = -1) Then intResult = cDAClearRow(DA, DA.nRows, -1)
  206.       Case 6         'clear last col in all sheets
  207.          intResult = cDACreate(DA, False)
  208.          If (intResult = -1) Then intResult = cDAClearCol(DA, DA.nCols, -1)
  209.    End Select
  210.    strDisplay = strDisplay & "Last intResult = " & intResult & vbCrLf & vbCrLf
  211.    If (intResult = True) Then
  212.       
  213.       strOpen = strOpen & "daSize       = " & DA.daSize & vbCrLf
  214.       strOpen = strOpen & "Signature    = " & DA.signature & vbCrLf
  215.       strOpen = strOpen & "nFilename    = " & Trim$(cGetInPartR(DA.nFilename, "\", True)) & vbCrLf
  216.       strOpen = strOpen & "nType        = " & DA.nType & vbCrLf
  217.       strOpen = strOpen & "nIsTyped     = " & DA.nIsTyped & vbCrLf
  218.       strOpen = strOpen & "nRows        = " & DA.nRows & vbCrLf
  219.       strOpen = strOpen & "nCols        = " & DA.nCols & vbCrLf
  220.       strOpen = strOpen & "nSheets      = " & DA.nSheets & vbCrLf
  221.       strOpen = strOpen & "rHandle      = " & DA.rHandle & vbCrLf
  222.       strOpen = strOpen & "rElementSize = " & DA.rElementSize & vbCrLf
  223.       strOpen = strOpen & "rFileSize    = " & DA.rFileSize & vbCrLf
  224.       strOpen = strOpen & "rParts       = " & DA.rParts & vbCrLf
  225.       strOpen = strOpen & "rRemain      = " & DA.rRemain & vbCrLf
  226.       strOpen = strOpen & "rSheetSize   = " & DA.rSheetSize & vbCrLf
  227.       strOpen = strOpen & "rTime        = " & DA.rTime & vbCrLf & vbCrLf
  228.       If (intManagement = True) Then
  229.       
  230.          Call cDAPut(DA, 1, 1, 1, "D:1, ABCDEFGHIJ")
  231.          Call cDAPut(DA, 1, DA.nCols, 1, "D:1, abcdefghij")
  232.          Call cDAPut(DA, DA.nRows, 1, 1, "D:1, OPQRSTUVWXYZ")
  233.          Call cDAPut(DA, DA.nRows, DA.nCols, 1, "D:1, oprqstuvwxyz")
  234.          Call cDAPut(DA, 1, 1, 2, "D:2, 1234567890")
  235.          Call cDAPut(DA, 1, DA.nCols, 2, "D:2, 0987654321")
  236.          Call cDAPut(DA, DA.nRows, 1, 2, "D:2, 12345ABCDE")
  237.          Call cDAPut(DA, DA.nRows, DA.nCols, 2, "D:2, VWXYZ54321")
  238.       End If
  239.       strDisplay = strDisplay & "R:1  , C:1  , D:1, Value : " & Trim$(cDAGet(DA, 1, 1, 1)) & "   , time : " & DA.rTime & vbCrLf
  240.       strDisplay = strDisplay & "R:1  , C:" & DA.nCols & ", D:1, Value : " & Trim$(cDAGet(DA, 1, DA.nCols, 1)) & "   , time : " & DA.rTime & vbCrLf
  241.       strDisplay = strDisplay & "R:" & DA.nRows & ", C:1  , D:1, Value : " & Trim$(cDAGet(DA, DA.nRows, 1, 1)) & "   , time : " & DA.rTime & vbCrLf
  242.       strDisplay = strDisplay & "R:" & DA.nRows & ", C:" & DA.nCols & ", D:1, Value : " & Trim$(cDAGet(DA, DA.nRows, DA.nCols, 1)) & "   , time : " & DA.rTime & vbCrLf
  243.       strDisplay = strDisplay & "R:1  , C:1  , D:2, Value : " & Trim$(cDAGet(DA, 1, 1, 2)) & "   , time : " & DA.rTime & vbCrLf
  244.       strDisplay = strDisplay & "R:1  , C:" & DA.nCols & ", D:2, Value : " & Trim$(cDAGet(DA, 1, DA.nCols, 2)) & "   , time : " & DA.rTime & vbCrLf
  245.       strDisplay = strDisplay & "R:" & DA.nRows & ", C:1  , D:2, Value : " & Trim$(cDAGet(DA, DA.nRows, 1, 2)) & "   , time : " & DA.rTime & vbCrLf
  246.       strDisplay = strDisplay & "R:" & DA.nRows & ", C:" & DA.nCols & ", D:2, Value : " & Trim$(cDAGet(DA, DA.nRows, DA.nCols, 2)) & "   , time : " & DA.rTime & vbCrLf
  247.    End If
  248.    Call cDAClose(DA, False)
  249.    lbl_Open = strOpen
  250.    lbl_Result = strDisplay
  251.    'time the function
  252.    TimerHandle = cTimerOpen()
  253.    TimerStartOk = cTimerStart(TimerHandle)
  254.    For i = 1 To Iteration
  255.       strResult = cDACreate(DA, False)
  256.       Call cDAClose(DA, False)
  257.    Next i
  258.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  259.    TimerCloseOk = cTimerClose(TimerHandle)
  260. End Sub
  261.